#pragma once

#include "ZSocketNetworkController.h"

namespace	Z	{

//------------------------------------------------------------------------------------------------------------------------

class	_ZNetworkApi	ClientSocketNetworkController
	:	public SocketNetworkController
{
public:
	static	const	NetworkId	host	= 0;
public:
	ClientSocketNetworkController(const std::string& address, u_short port, size_t numPooledThread);
	virtual	~ClientSocketNetworkController();
private:
	virtual	bool	start(MessageReceiver* pMessageReceiver);
	virtual	void	cleanup();
	virtual	bool	onCreate(AsyncSocket* pSocket);
	virtual	bool	onClose(NetworkId kNetworkId, bool graceful, bool notify);
	virtual	bool	onIoComplete(NetworkId kNetworkId, size_t bytesTransferred, OVERLAPPED* pOverlapped);
	virtual	AsyncSocket*	getSocket(NetworkId kNetworkId)	const;
	virtual	void	send(Stream* pStream, NetworkId kNetworkId);

private:
	AsyncSocket*	mSocket;
	NetworkAddress	mAddress;
};

}